<template>
  <div id="skill_page_menu">
    <div class="logo">

    </div>
    <div class="menu">
      <div class="tab">
        <!--        <div v-if="1===nowType" class="green-line"></div>-->
        <div  class="tab-in" @click="clickType('summary',1)">
          <span :class="{ch: 1===nowType}">大纲区</span>
        </div>
        <div class="un-point"></div>
        <div v-if="1===nowType" class="point"></div>
      </div>
      <div class="tab">
        <!--        <div v-if="2===nowType" class="green-line"></div>-->
        <div class="tab-in" @click="clickType('learn',2)">
          <span :class="{ch: 2===nowType}">学习区</span>
        </div>
        <div class="un-point"></div>
        <div v-if="2===nowType" class="point"></div>
      </div>
      <div class="tab">
        <!--        <div v-if="3===nowType" class="green-line"></div>-->
        <div  class="tab-in" @click="clickType('note',3)">
          <span :class="{ch: 3===nowType}">笔记区</span>
        </div>
        <div class="un-point"></div>
        <div v-if="3===nowType" class="point"></div>
      </div>
      <div class="tab">
        <!--        <div v-if="4===nowType" class="green-line"></div>-->
        <div class="tab-in" @click="clickType('questions',4)">
          <span :class="{ch: 4===nowType}">提问区</span>
        </div>
        <div class="un-point"></div>
        <div v-if="4===nowType" class="point"></div>
      </div>
    </div>
    <div class="back-to-index" @click="$router.push('/skillHome')">
      返回首页
    </div>
  </div>
</template>

<script>
export default {
  name: "skill_page_menu",
  data() {
    return {
      type:'',
      chosen: 0
    }
  },
  computed : {
    // 根据当前路由 决定目录选中状态
    nowType() {
      switch (this.$route.name) {
        case "skillPage-summary" :return 1;
        case "skillPage-learn" :return 2;
        case "skillPage-note-detail" :
        case "skillPage-note-list" :return 3;
        case "skillPage-questions-list" :
        case "skillPage-questions-edit" :return 4;
      }
    }
  },
  methods: {
    clickType(data,c) {
      this.$emit("getType",data);
      this.chosen = c;
    }
  }
}
</script>

<style lang="scss" scoped>
@import "./src/assets/style/common.scss";
#skill_page_menu {
  position: fixed;
  left: 210px;
  top: 80px;
  bottom:0;
  box-sizing: border-box;
  padding-left: 10px;
  width: 160px;
  height: 100%;
  background-color: rgba(0,0,0,0);
  display: flex;
  flex-direction: column;
  .logo{
    width: 100%;
    height: 20px;
    margin-bottom: 20px;
  }
  .menu {
    box-sizing: border-box;
    padding: 10px 0 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    border-right: 5px white solid;
    text-align: center;
    .tab {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: space-between;
      box-sizing: border-box;
      height: 100px;
      width: 100%;
      padding: 10px 0;
      background-color: rgba(0,0,0,0);
      color:white;
      font-size: 24px;
      font-weight: 600;
      transition: 0.6s;
      .green-line{
        width: 8px;
        height: 40px;
        margin-right: -20px;
        background-color: #58c15e;
      }
      .point {
        position: absolute;
        width: 12px;
        height: 12px;
        left: 137px;
        text-align: center;
        line-height: 22px;
        margin: 0 auto;
        background-color: #b0b0b0;
        border-radius: 50%;
        border: 5px solid white;
      }
      .un-point {
        position: absolute;
        width: 22px;
        height: 22px;
        left: 137px;
        border-radius: 11px;
        background-color: #fff;
        transition: 0.5s;
      }
      .tab-in{
        height: 90px;
        line-height: 90px;
        //margin-left: -10px;
        cursor: pointer;
      }
      &:hover {
        transition: 0.6s;
        color: #6fcb73;
      }
      .ch {
        color: #6fcb73;
      }
      &:last-child{
        border-bottom: 0;
      }

    }
  }
  .back-to-index {
    width: 100px;
    height: 28px;
    line-height: 28px;
    color: white;
    background-color: #58c15e;
    margin-top: 50px;
    border-radius: 5px;
    cursor: pointer;
    transition: 0.6s;
    text-align: center;
    &:hover {
      transition: 0.6s;
      background-color: #4e9953;
    }
  }
}
</style>
